﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Microsoft.Popfly.GameCreator.GameEngine.Behaviors
{
    public static class AppearBehaviorFactory
    {
        public static IBehavior CreateAppearBehavior(Game game, BehaviorOwner owner, Data.BehaviorInfo behaviorInfo)
        {
            if (behaviorInfo.GetType() != typeof(Data.AppearBehaviorInfo))
            {
                throw new ArgumentException(
                    Utils.ErrorMessagePrefix +
                    "CreateAppearBehavior only takes behaviorInfo of type AppearBehaviorInfo.  behaviorInfo was of type '" +
                    behaviorInfo.GetType().ToString() + "'."
                    );
            }
            Data.AppearBehaviorInfo appearInfo = (Data.AppearBehaviorInfo)behaviorInfo;
            switch (appearInfo.Relative)
            {
                case "World" :
                    return new AppearBehavior(game, owner, behaviorInfo);
                case "Parent" :
                    return new AppearRelativeBehavior(game, owner, behaviorInfo);
                default :
                    throw new NotImplementedException(
                        Utils.ErrorMessagePrefix +
                        "CreateAppearBehavior doesn't know how to handle appear behaviors with a Relative type of '" +
                        appearInfo.Relative +
                        "'.");
            }
        }
    }
}
